package com.freak.wanandroid.net;


import io.reactivex.rxjava3.functions.Function;

/**
 * 此方法是接口返回数据的解析
 * @param <T>
 */
public class HttpResultFuncNew<T> implements Function<HttpResultNew<T>, T> {

    @Override
    public T apply(HttpResultNew<T> tHttpResult) throws Throwable {
        if (tHttpResult.getError_code() != 0) {
            throw new ApiException(tHttpResult.getReason());
        }
        return tHttpResult.getResult();
    }
}
